
let curry = function(fn,...arg){
    const that = this
    return function(...argResult){
        const totalArgs = [...arg,...argResult]
        if(fn.length >= totalArgs.length){
           return fn.apply(null,totalArgs)
        }else{
           return curry.apply(that,[fn,totalArgs])
        }
    }
}

let funs = (x,y,z)=>{
    return (x+y)*z
}

let g = curry(funs,13)
console.log(g(2,3))